using System.Collections.Generic;

public class Table_GlobalDataItem : IDataItem
{
	/// <summary>
	/// 唯一ID
	/// <summary>
	public int Id { get; private set; }
	/// <summary>
	/// 参数Int
	/// <summary>
	public int IntParam { get; private set; }
	/// <summary>
	/// 参数Boolean
	/// <summary>
	public bool BooleanParam { get; private set; }
	/// <summary>
	/// 参数String
	/// <summary>
	public string StringParam { get; private set; }

	public Table_GlobalDataItem(ExcelLineReader reader)
	{
		Id = reader.ReadInt();
		IntParam = reader.ReadInt();
		BooleanParam = reader.ReadBool();
		StringParam = reader.ReadString();
	}
}

public class Table_GlobalDataMgr : IDataMgr
{
	protected override string FileName { get { return "Txt/GlobalData.txt"; } }

	protected Dictionary<int, int> mItemDic = new Dictionary<int, int>();
	public int GetIdxById(int key) { return mItemDic[key]; }

	public override void Load(ExcelLineReader reader)
	{
		var item = new Table_GlobalDataItem(reader);
		mItemDic[item.Id] = DataCount;
		mItemList.Add(item);
	}

	public Table_GlobalDataItem GetItemByIdx(int idx)
	{
		return GetItemByIdx<Table_GlobalDataItem>(idx);
	}

	public Table_GlobalDataItem GetItemById(int id)
	{
		int idx = GetIdxById(id);
		return GetItemByIdx(idx);
	}
}